function curry(fn, ...restProps){
    function curried(...args){
        return curry(fn,...restProps,...args)
    }
    curried.toString = function(){
        return fn(...restProps)
    }
    return curried
}

function dynamicAdd() {
    return [...arguments].reduce((prev, curr) => {
      return prev + curr
    }, 0)
}
let add = curry(dynamicAdd)
let x = add(1)(2)
console.log(x);
//alert(x)